@workerdeck/ui 0.7.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +44 -3
  2. package/build/index.d.mts +767 -21
  3. package/build/index.mjs +3268 -348
  4. package/build/index.mjs.map +1 -1
  5. package/package.json +5 -4
  6. package/src/components/agent/CodeEditor.tsx +300 -0
  7. package/src/components/agent/Composer.tsx +379 -56
  8. package/src/components/agent/ContextDialog.tsx +99 -0
  9. package/src/components/agent/EditorTabs.tsx +165 -0
  10. package/src/components/agent/FileTree.tsx +287 -0
  11. package/src/components/agent/FileViewer.tsx +148 -0
  12. package/src/components/agent/HostFilesDialog.tsx +218 -0
  13. package/src/components/agent/McpDialog.tsx +363 -0
  14. package/src/components/agent/ModelSelect.tsx +34 -6
  15. package/src/components/agent/PermissionModeSelect.tsx +99 -22
  16. package/src/components/agent/PermissionPrompt.tsx +72 -6
  17. package/src/components/agent/PromptTokenText.tsx +39 -0
  18. package/src/components/agent/SessionEmptyState.tsx +65 -0
  19. package/src/components/agent/SessionInfoDialog.tsx +163 -0
  20. package/src/components/agent/SessionPanel.tsx +380 -40
  21. package/src/components/agent/SessionWorkspace.tsx +282 -0
  22. package/src/components/agent/SkillsDialog.tsx +195 -0
  23. package/src/components/agent/StatusBar.tsx +85 -18
  24. package/src/components/agent/ToolCallCard.tsx +80 -4
  25. package/src/components/agent/Transcript.tsx +109 -12
  26. package/src/components/agent/UsageDialog.tsx +168 -0
  27. package/src/components/prompt-area/prompt-area-engine.ts +53 -0
  28. package/src/components/prompt-area/types.ts +15 -0
  29. package/src/components/prompt-area/use-prompt-area.ts +20 -0
  30. package/src/components/ui/CopyButton.tsx +8 -1
  31. package/src/components/ui/Dialog.tsx +92 -0
  32. package/src/components/ui/Menu.tsx +55 -0
  33. package/src/components/ui/Splitter.tsx +133 -0
  34. package/src/components/ui/Tooltip.tsx +22 -5
  35. package/src/index.ts +53 -1
  36. package/src/lib/clipboard.ts +56 -0
  37. package/src/lib/format.ts +48 -0
  38. package/src/lib/tool-icon.ts +74 -0
package/README.md CHANGED
@@ -1,9 +1,16 @@
1
1
  # @workerdeck/ui
2
2
 
3
3
  Styled agent-control component library for WorkerDeck hosts: `SessionPanel` (status bar +
4
- streaming transcript + tool-call cards + permission prompts + composer), `SessionList`, and the
5
- underlying primitives (Button, Badge, Card, Select, AlertDialog, …). Built on **Tailwind v4 +
6
- Base UI + cva**, themed by CSS tokens with light/dark via `<html data-theme>`.
4
+ streaming transcript + tool-call cards + permission prompts + composer with attachments and
5
+ `@file` / `/command` completion, plus the panels behind it session info, context, plan usage,
6
+ MCP servers, project files), `SessionWorkspace` (a VS Code-shaped layout *around* that panel
7
+ file tree, editor tabs, Monaco), `SessionList`, and the underlying primitives (Button, Badge,
8
+ Card, Select, Dialog, AlertDialog, …). Built on **Tailwind v4 + Base UI + cva**, themed by CSS
9
+ tokens with light/dark via `<html data-theme>`.
10
+
11
+ Everything `SessionPanel` offers is gated on the session's **engine capability record**, so the
12
+ same component is correct for a Claude, Codex or provider session without the host branching:
13
+ a control the engine can't honor is absent rather than present-and-failing.
7
14
 
8
15
  The headless layer (`useClaudeSession`, transcript reducer) lives in `@workerdeck/react`;
9
16
  this package is the styling opinion on top.
@@ -57,6 +64,40 @@ const client = new WorkerDeckClient({ baseUrl: `${location.origin}/v1` })
57
64
  <SessionPanel key={sessionId} client={client} sessionId={sessionId} />
58
65
  ```
59
66
 
67
+ ### The workspace (optional)
68
+
69
+ `SessionWorkspace` wraps that same panel in a three-region layout — project tree on the left,
70
+ open files above, agent below — and is **strictly additive**: `SessionPanel` is untouched and
71
+ still complete on its own, so pick whichever fits. An app with its own file tree keeps the panel.
72
+
73
+ ```tsx
74
+ import { SessionWorkspace } from '@workerdeck/ui'
75
+
76
+ <SessionWorkspace key={sessionId} client={client} sessionId={sessionId} />
77
+ ```
78
+
79
+ It needs the gateway's host-filesystem routes (`hostFiles` in the server config); without them
80
+ the rail is simply absent and you get the panel. Editing additionally needs `hostFiles.write`,
81
+ which is a separate opt-in and defaults **off** — the editor reads `/fs/roots` and renders
82
+ read-only when it's not enabled. Saves are conditional on the hash the tab read, so a save that
83
+ collides with the agent's own edit is refused (409) and offered as a choice rather than silently
84
+ winning.
85
+
86
+ **If you bundle with Vite, you need one line** — the workspace uses Monaco, which reaches its
87
+ web workers with `new Worker(new URL(…, import.meta.url))`. Rollup resolves that at build time,
88
+ but Vite's dev dep-optimizer rewrites the package into `.vite/deps/` and breaks the relative URL;
89
+ Monaco then *silently* runs worker code on the main thread:
90
+
91
+ ```ts
92
+ // vite.config.ts
93
+ export default defineConfig({ optimizeDeps: { exclude: ['monaco-editor'] } })
94
+ ```
95
+
96
+ Monaco is loaded through a dynamic `import()`, so it costs nothing until a file is opened. Our
97
+ own dashboard additionally aliases away Monaco's four worker-backed language services
98
+ (TypeScript/JSON/CSS/HTML) — 8.8MB of build output for IntelliSense and schema validation, with
99
+ syntax highlighting unaffected — see `packages/web/vite.config.ts` if you want the same trade.
100
+
60
101
  Every component takes `className` and carries `data-slot` attributes for targeted overrides.
61
102
 
62
103
  `SessionPanel` is self-sufficient for errors: a `protocol_error` (the gateway or CLI refusing a